package com.example.dwhne.leonweather;

import android.Manifest;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.os.Build;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
import android.widget.Toast;

import java.util.Calendar;

import interfaces.heweather.com.interfacesmodule.view.HeConfig;

public class Welcome extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
//        setContentView(R.layout.activity_welcome);
        HeConfig.init("xxxx", "xxxxxxx");//和风天气初始化
        HeConfig.switchToFreeServerNode();//和风天气免费接口

        //读取存储信息
        SharedPreferences F1 = getSharedPreferences("cities", MODE_PRIVATE);
        String mFlog = F1.getString("CN0", "");
//        Toast.makeText(Welcome.this, "存储的memoryFlog:"+mFlog, Toast.LENGTH_SHORT).show();
        if (!mFlog.equals("")) {
            Intent intent11 = new Intent(Welcome.this, WeatherShow.class);
            SharedPreferences.Editor hPosition = getSharedPreferences("historyPosition", MODE_PRIVATE).edit();
            hPosition.putInt("Position", 0);
            hPosition.commit();
            startActivity(intent11);
            finish();
        } else {
            Intent intent22 = new Intent(Welcome.this, CitySelect.class);
            startActivity(intent22);
            finish();
        }

    }
}

